# -*- coding:utf-8 -*-
#! python3
from facecat import *

gPaint = FCPaint() #创建绘图对象
gPaint.defaultUIStyle = "dark"

#消息循环
def WndProc(hwnd,msg,wParam,lParam):
	return WndProcDefault(gPaint,hwnd,msg,wParam,lParam)

#创建窗体
createMainWindow(gPaint, "facecat-py", WndProc)

#创建分割视图
split = FCSplitLayoutDiv()
#设置大小
split.size = FCSize(400, 400)
#添加到框架中
addView(split, gPaint)
if split.paint.defaultUIStyle == "dark":
	split.backColor = "rgb(0,0,0)"
	split.borderColor = "rgb(100,100,100)"
	split.textColor = "rgb(255,255,255)"
elif split.paint.defaultUIStyle == "light":
	split.backColor = "rgb(255,255,255)"
	split.borderColor = "rgb(150,150,150)"
	split.textColor = "rgb(0,0,0)"

#填充布局
split.dock = "fill"    
        
#创建分割条
splitter = FCView()
#允许拖拽
splitter.allowDrag = True
#根据主题配色
if split.paint.defaultUIStyle == "dark":
	splitter.backColor = "rgb(150,150,150)"
elif split.paint.defaultUIStyle == "light":
	splitter.backColor = "rgb(100,100,100)"
#填充到父视图
addViewToParent(splitter, split)
#指定分割条
split.splitter = splitter
#设置分割条的初始位置
splitter.location = FCPoint(200, 0)
#设置分割条的初始大小
splitter.size = FCSize(5, 0)
        
#创建第一个视图
firstView = FCView()
firstView.backColor = "rgb(255,0,0)"
#添加到父视图
addViewToParent(firstView, split)
#指定第一个视图
split.firstView = firstView

#创建第二个视图
secondView = FCView()
secondView.backColor = "rgb(0,255,0)"
#添加到父视图
addViewToParent(secondView, split)
#指定第二个视图
split.secondView = secondView
#设置初始大小
split.oldSize = FCSize(split.size.cx, split.size.cy)
#重置分割条布局
resetSplitLayoutDiv(split)

updateViewDefault(gPaint.views)
showWindow(gPaint)